﻿using System.Linq.Expressions;
using SqlSugar;

namespace SqlSugarHelper
{
    public interface ISqlQueue<T> : ISqlQueue where T : class, new()
    {
        void Delete(Expression<Func<T, bool>> filter);
        void Delete<Other>(Expression<Func<T, Other, bool>> filter) where Other : class, new();
        void Insert(T item);
        void Insert(T[] items);
        void Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> filter);
        IUpdateable<T> Update(Expression<Func<T, bool>> filter);
        void Update(T data, string[] column);
        void UpdateOnly(T[] datas, Expression<Func<T, object>> setCol);
        bool Update(T source, T set);
        void Update(T[] datas, params string[] ignoreColumn);
        void Update<Set>(Set set, Expression<Func<T, bool>> filter);
        bool Update<Set>(T source, Set set);
        void Update(T[] datas, Expression<Func<T, object>> filter);

        int Submit(bool isTran = true);
    }
    public interface ISqlQueue
    {
        void Delete<T>(Expression<Func<T, bool>> filter) where T : class, new();
        void Delete<T, Other>(Expression<Func<T, Other, bool>> filter) where Other : class, new() where T : class, new();
        void Insert<T>(T item) where T : class, new();
        void Insert<T>(T[] items) where T : class, new();
        void Update<T>(Expression<Func<T, T>> columns, Expression<Func<T, bool>> filter) where T : class, new();
        void Update<T>(T data, string[] column) where T : class, new();
        bool Update<T>(T source, T set) where T : class, new();

        void Update<T>(T[] datas, params string[] ignoreColumn) where T : class, new();
        void Update<T, Set>(Set set, Expression<Func<T, bool>> filter) where T : class, new();
        bool Update<T, Set>(T source, Set set) where T : class, new();
    }
}